cmake_minimum_required(VERSION 3.16)

project(ClientAnalysis VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 REQUIRED COMPONENTS Quick Svg Network Sql)


qt_add_executable(appClientAnalysis
    main.cpp
    Database/AnalysisSql.cpp
    Tools/Helper.cpp
    Task/AsyncRunner.cpp
    Task/TaskWrapper.cpp
    Test/ClientTest.cpp
    Task/TaskApi.cpp
    AppConfig.cpp
    Task/ScanApi.cpp
    Database/QmlSqlWrapper.cpp
    Tools/UITools.cpp
)

# 这个行为应该是直接拷贝
qt_add_qml_module(appClientAnalysis
    URI ClientAnalysis
    VERSION 1.0
    QML_FILES
        UI/EMFlickableImage.qml
        UI/EMGradeChart.qml
        UI/EMAnalysisDetail.qml
        UI/EMColumnDetail.qml
        UI/EMColumnImageWrapper.qml
        UI/EMColumnChartWrapper.qml
        UI/EMSearchBox.qml
        UI/EMIdExpander.qml
        UI/EMPatientList.qml
        UI/EMPatientTable.qml
        UI/EMManager.qml
        UI/EMMain.qml
    SOURCES
        AppConfig.h
        Database/AnalysisSql.h
        Task/AsyncRunner.h
        Tools/Helper.h
        Test/ClientTest.h
        Task/TaskWrapper.h
        Task/TaskApi.h
        Task/ScanApi.h
        Database/QmlSqlWrapper.h
        Tools/UITools.h
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appClientAnalysis PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appClientAnalysis
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appClientAnalysis
    PRIVATE
        Qt6::Quick
        Qt6::Svg
        Qt6::Network
        Qt6::Sql
)

include(GNUInstallDirs)
install(TARGETS appClientAnalysis
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
